package com.liliya.service.impl;

import com.liliya.dao.SubCateDao;
import com.liliya.dao.impl.SubCateDaoImpl;
import com.liliya.pojo.SubCate;
import com.liliya.service.SubCateService;

import java.util.List;

/**
 * @Description TODO
 * @Author hhy
 * @Date 2021/1/10 19:07
 */
public class SubCateServiceImpl implements SubCateService {
    private SubCateDao subCateDao = new SubCateDaoImpl();

    @Override
    public void insertSubCate(SubCate subCate) {
        subCateDao.insertSubCate(subCate);
    }

    @Override
    public void deleteSubCate(Integer subCateNum) {
        subCateDao.deleteSubCate(subCateNum);
    }

    @Override
    public List<SubCate> findSubCate(Integer start, Integer end,Integer catenum) {
        return subCateDao.findSubCate(start,end,catenum);
    }

    @Override
    public void updateSubCate(SubCate subCate) {
        subCateDao.updateSubCate(subCate);
    }

    @Override
    public int totalSubCate() {
        return subCateDao.totalSubCate();
    }

    @Override
    public int pageSubCate(Integer step) {
        int total = totalSubCate();
        if (total%step==0){
            return total/step;
        }else return total/step+1;
    }

    @Override
    public SubCate findSubCateByNum(Integer subCateNum) {
        return subCateDao.findSubCateByNum(subCateNum);
    }
}
